<%-- 
    Document   : joinTeam
    Created on : Jul 3, 2011, 12:57:10 AM
    Author     : Hung
--%>

<%@page import="edu.gatech.gellinservlet.model.Team"%>
<%@page import="edu.gatech.gellinservlet.model.Student"%>
<%@page import="edu.gatech.gellinservlet.model.User"%>
<jsp:useBean id="teamData" scope="application" class="edu.gatech.gellinservlet.model.TeamManager" />
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<% //make the course manager add the student to the course
        String teamName = request.getParameter("team");
        User tempPageVar = (User)session.getAttribute("persistUser");
        if (teamName != null)
        {
            if (tempPageVar instanceof Student)
            {
                Team aTeam = teamData.search(teamName);
                System.out.println(aTeam);
                teamData.addStudentToTeam((Student)tempPageVar, aTeam.getID());
                response.sendRedirect("stude_home.jsp");
            }
        }

        teamData.save("teamData.ser");

%>
